GOBJECT_INTROSPECTION_MIN_VERSION=0.6.9
GJS_MIN_VERSION=0.6
MUTTER_MIN_VERSION=2.29.1
+GTK_MIN_VERSION=2.20.0
# Collect more than 20 libraries for a prize!
-PKG_CHECK_MODULES(MUTTER_PLUGIN, gio-unix-2.0 gtk+-2.0 dbus-glib-1
+PKG_CHECK_MODULES(MUTTER_PLUGIN, gio-unix-2.0 dbus-glib-1
+ gtk+-2.0 >= $GTK_MIN_VERSION
mutter-plugins >= $MUTTER_MIN_VERSION
gjs-gi-1.0 >= $GJS_MIN_VERSION
libgnome-menu $recorder_modules gconf-2.0
shell_embedded_window_show (GtkWidget *widget)
{
ShellEmbeddedWindow *window = SHELL_EMBEDDED_WINDOW (widget);
+ GtkWidgetClass *widget_class;
- GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
+ /* Skip GtkWindow, but run the default GtkWidget handling which
+ * marks the widget visible */
+ widget_class = g_type_class_peek (GTK_TYPE_WIDGET);
+ widget_class->show (widget);
if (window->priv->actor)
{
* modifying the GDK hierarchy.
*/
XReparentWindow (GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget)),
- GDK_WINDOW_XWINDOW (widget->window),
+ GDK_WINDOW_XWINDOW (gtk_widget_get_window (widget)),
stage_xwindow,
window->priv->position.x, window->priv->position.y);
}
window->priv->actor = actor;
- if (GTK_WIDGET_VISIBLE (window) && CLUTTER_ACTOR_IS_REALIZED (actor))
+ if (gtk_widget_get_visible (GTK_WIDGET (window))
+ && CLUTTER_ACTOR_IS_REALIZED (actor))
gtk_widget_map (GTK_WIDGET (window));
}
window->priv->position.width = width;
window->priv->position.height = height;
- if (GTK_WIDGET_REALIZED (window))
- gdk_window_move_resize (GTK_WIDGET (window)->window,
+ if (gtk_widget_get_realized (GTK_WIDGET (window)))
+ gdk_window_move_resize (gtk_widget_get_window (GTK_WIDGET (window)),
x, y, width, height);
allocation.x = 0;
{
g_return_if_fail (SHELL_IS_EMBEDDED_WINDOW (window));
- if (GTK_WIDGET_VISIBLE (window))
+ if (gtk_widget_get_visible (GTK_WIDGET (window)))
gtk_widget_map (GTK_WIDGET (window));
}
* screen.
*/
clutter_x11_texture_pixmap_set_window (CLUTTER_X11_TEXTURE_PIXMAP (embed),
- GDK_WINDOW_XWINDOW (widget->window),
+ GDK_WINDOW_XWINDOW (gtk_widget_get_window (widget)),
FALSE);
}
g_signal_connect (embed->priv->window, "realize",
G_CALLBACK (shell_gtk_embed_on_window_realize), embed);
- if (GTK_WIDGET_REALIZED (window))
+ if (gtk_widget_get_realized (GTK_WIDGET (window)))
shell_gtk_embed_on_window_realize (GTK_WIDGET (embed->priv->window), embed);
}
{
ShellGtkEmbed *embed = SHELL_GTK_EMBED (actor);
- if (embed->priv->window && GTK_WIDGET_VISIBLE (embed->priv->window))
+ if (embed->priv->window
+ && gtk_widget_get_visible (GTK_WIDGET (embed->priv->window)))
{
GtkRequisition requisition;
gtk_widget_size_request (GTK_WIDGET (embed->priv->window), &requisition);
{
ShellGtkEmbed *embed = SHELL_GTK_EMBED (actor);
- if (embed->priv->window && GTK_WIDGET_VISIBLE (embed->priv->window))
+ if (embed->priv->window
+ && gtk_widget_get_visible (GTK_WIDGET (embed->priv->window)))
{
GtkRequisition requisition;
gtk_widget_size_request (GTK_WIDGET (embed->priv->window), &requisition);
{
bg_pixmap = create_bg_pixmap (gtk_widget_get_colormap (widget),
&child->manager->priv->bg_color);
- gdk_window_set_back_pixmap (widget->window, bg_pixmap, FALSE);
+ gdk_window_set_back_pixmap (gtk_widget_get_window (widget),
+ bg_pixmap, FALSE);
g_object_unref (bg_pixmap);
}
}
{
NaTrayChild *child = NA_TRAY_CHILD (widget);
GdkVisual *visual = gtk_widget_get_visual (widget);
+ GdkWindow *window;
GTK_WIDGET_CLASS (na_tray_child_parent_class)->realize (widget);
+ window = gtk_widget_get_window (widget);
+
if (child->has_alpha)
{
/* We have real transparency with an ARGB visual and the Composite
/* Set a transparent background */
GdkColor transparent = { 0, 0, 0, 0 }; /* only pixel=0 matters */
- gdk_window_set_background (widget->window, &transparent);
- gdk_window_set_composited (widget->window, TRUE);
+ gdk_window_set_background (window, &transparent);
+ gdk_window_set_composited (window, TRUE);
child->parent_relative_bg = FALSE;
}
- else if (visual == gdk_drawable_get_visual (GDK_DRAWABLE (gdk_window_get_parent (widget->window))))
+ else if (visual == gdk_drawable_get_visual (GDK_DRAWABLE (gdk_window_get_parent (window))))
{
/* Otherwise, if the visual matches the visual of the parent window, we
* can use a parent-relative background and fake transparency. */
- gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
+ gdk_window_set_back_pixmap (window, NULL, TRUE);
child->parent_relative_bg = TRUE;
}
child->parent_relative_bg = FALSE;
}
- gdk_window_set_composited (widget->window, child->composited);
+ gdk_window_set_composited (window, child->composited);
gtk_widget_set_app_paintable (GTK_WIDGET (child),
child->parent_relative_bg || child->has_alpha);
{
NaTrayChild *child = NA_TRAY_CHILD (widget);
- gboolean moved = allocation->x != widget->allocation.x ||
- allocation->y != widget->allocation.y;
- gboolean resized = allocation->width != widget->allocation.width ||
- allocation->height != widget->allocation.height;
+ GdkWindow *window;
+ GtkAllocation widget_allocation;
+ gboolean moved, resized;
+
+ gtk_widget_get_allocation (widget, &widget_allocation);
+ moved = allocation->x != widget_allocation.x ||
+ allocation->y != widget_allocation.y;
+ resized = allocation->width != widget_allocation.width ||
+ allocation->height != widget_allocation.height;
+ window = gtk_widget_get_window (widget);
/* When we are allocating the widget while mapped we need special handling
* for both real and fake transparency.
* Fake transparency: if the widget moved, we need to force the contents to
* be redrawn with the new offset for the parent-relative background.
*/
- if ((moved || resized) && GTK_WIDGET_MAPPED (widget))
+ if ((moved || resized) && gtk_widget_get_mapped (widget))
{
if (na_tray_child_has_alpha (child))
- gdk_window_invalidate_rect (gdk_window_get_parent (widget->window),
- &widget->allocation, FALSE);
+ gdk_window_invalidate_rect (gdk_window_get_parent (window),
+ &widget_allocation, FALSE);
}
GTK_WIDGET_CLASS (na_tray_child_parent_class)->size_allocate (widget,
allocation);
- if ((moved || resized) && GTK_WIDGET_MAPPED (widget))
+ if ((moved || resized) && gtk_widget_get_mapped (widget))
{
if (na_tray_child_has_alpha (NA_TRAY_CHILD (widget)))
- gdk_window_invalidate_rect (gdk_window_get_parent (widget->window),
- &widget->allocation, FALSE);
+ gdk_window_invalidate_rect (gdk_window_get_parent (window),
+ &widget_allocation, FALSE);
else if (moved && child->parent_relative_bg)
na_tray_child_force_redraw (child);
}
GdkEventExpose *event)
{
NaTrayChild *child = NA_TRAY_CHILD (widget);
+ GdkWindow *window = gtk_widget_get_window (widget);
if (na_tray_child_has_alpha (child))
{
/* Clear to transparent */
- cairo_t *cr = gdk_cairo_create (widget->window);
+ cairo_t *cr = gdk_cairo_create (window);
cairo_set_source_rgba (cr, 0, 0, 0, 0);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
gdk_cairo_region (cr, event->region);
else if (child->parent_relative_bg)
{
/* Clear to parent-relative pixmap */
- gdk_window_clear_area (widget->window,
+ gdk_window_clear_area (window,
event->area.x, event->area.y,
event->area.width, event->area.height);
}
na_tray_child_set_composited (NaTrayChild *child,
gboolean composited)
{
+ GdkWindow *window;
g_return_if_fail (NA_IS_TRAY_CHILD (child));
child->composited = composited;
- if (GTK_WIDGET_REALIZED (child))
- gdk_window_set_composited (GTK_WIDGET (child)->window, composited);
+ window = gtk_widget_get_window (GTK_WIDGET (child));
+ if (window)
+ gdk_window_set_composited (window, composited);
}
/* If we are faking transparency with a window-relative background, force a
void
na_tray_child_force_redraw (NaTrayChild *child)
{
+ GtkAllocation allocation;
GtkWidget *widget = GTK_WIDGET (child);
- if (GTK_WIDGET_MAPPED (child) && child->parent_relative_bg)
+ if (gtk_widget_get_mapped (GTK_WIDGET (child)) && child->parent_relative_bg)
{
#if 1
/* Sending an ExposeEvent might cause redraw problems if the
XEvent xev;
xev.xexpose.type = Expose;
- xev.xexpose.window = GDK_WINDOW_XWINDOW (GTK_SOCKET (child)->plug_window);
+ xev.xexpose.window = GDK_WINDOW_XWINDOW (gtk_socket_get_plug_window (GTK_SOCKET (child)));
xev.xexpose.x = 0;
xev.xexpose.y = 0;
- xev.xexpose.width = widget->allocation.width;
- xev.xexpose.height = widget->allocation.height;
+ xev.xexpose.width = allocation.width;
+ xev.xexpose.height = allocation.height;
xev.xexpose.count = 0;
gdk_error_trap_push ();
gtk_socket_add_id (GTK_SOCKET (child), icon_window);
- if (!GTK_SOCKET (child)->plug_window)
+ if (!gtk_socket_get_plug_window (GTK_SOCKET (child)))
{
/* Embedding failed, we won't get a plug-removed signal */
g_signal_emit (manager, manager_signals[TRAY_ICON_REMOVED], 0, child);
{
#ifdef GDK_WINDOWING_X11
GdkDisplay *display;
+ GdkWindow *window;
guint32 timestamp;
GtkWidget *invisible;
return;
invisible = manager->invisible;
+ window = gtk_widget_get_window (invisible);
g_assert (GTK_IS_INVISIBLE (invisible));
- g_assert (GTK_WIDGET_REALIZED (invisible));
- g_assert (GDK_IS_WINDOW (invisible->window));
+ g_assert (gtk_widget_get_realized (GTK_WIDGET (invisible)));
+ g_assert (GDK_IS_WINDOW (window));
display = gtk_widget_get_display (invisible);
if (gdk_selection_owner_get_for_display (display, manager->selection_atom) ==
- invisible->window)
+ window)
{
- timestamp = gdk_x11_get_server_time (invisible->window);
+ timestamp = gdk_x11_get_server_time (window);
gdk_selection_owner_set_for_display (display,
NULL,
manager->selection_atom,
//FIXME: we should also use gdk_remove_client_message_filter when it's
//available
// See bug #351254
- gdk_window_remove_filter (invisible->window,
+ gdk_window_remove_filter (window,
na_tray_manager_window_filter, manager);
manager->invisible = NULL; /* prior to destroy for reentrancy paranoia */
{
#ifdef GDK_WINDOWING_X11
GdkDisplay *display;
+ GdkWindow *window;
Atom orientation_atom;
gulong data[1];
- if (!manager->invisible || !manager->invisible->window)
+ if (!manager->invisible)
+ return;
+
+ window = gtk_widget_get_window (GTK_WIDGET (manager->invisible));
+
+ if (!window)
return;
display = gtk_widget_get_display (manager->invisible);
SYSTEM_TRAY_ORIENTATION_VERT;
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
- GDK_WINDOW_XWINDOW (manager->invisible->window),
+ GDK_WINDOW_XWINDOW (window),
orientation_atom,
XA_CARDINAL, 32,
PropModeReplace,
{
#ifdef GDK_WINDOWING_X11
GdkDisplay *display;
+ GdkWindow *window;
Visual *xvisual;
Atom visual_atom;
gulong data[1];
- if (!manager->invisible || !manager->invisible->window)
+ if (!manager->invisible)
+ return;
+
+ window = gtk_widget_get_window (GTK_WIDGET (manager->invisible));
+
+ if (!window)
return;
/* The visual property is a hint to the tray icons as to what visual they
data[0] = XVisualIDFromVisual (xvisual);
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
- GDK_WINDOW_XWINDOW (manager->invisible->window),
+ GDK_WINDOW_XWINDOW (window),
visual_atom,
XA_VISUALID, 32,
PropModeReplace,
GdkScreen *screen)
{
GdkDisplay *display;
+ GdkWindow *window;
Screen *xscreen;
GtkWidget *invisible;
char *selection_atom_name;
invisible = gtk_invisible_new_for_screen (screen);
gtk_widget_realize (invisible);
+
+ window = gtk_widget_get_window (GTK_WIDGET (invisible));
gtk_widget_add_events (invisible,
GDK_PROPERTY_CHANGE_MASK | GDK_STRUCTURE_MASK);
na_tray_manager_set_orientation_property (manager);
na_tray_manager_set_visual_property (manager);
- timestamp = gdk_x11_get_server_time (invisible->window);
+ timestamp = gdk_x11_get_server_time (window);
/* Check if we could set the selection owner successfully */
if (gdk_selection_owner_set_for_display (display,
- invisible->window,
+ window,
manager->selection_atom,
timestamp,
TRUE))
xev.data.l[0] = timestamp;
xev.data.l[1] = gdk_x11_atom_to_xatom_for_display (display,
manager->selection_atom);
- xev.data.l[2] = GDK_WINDOW_XWINDOW (invisible->window);
+ xev.data.l[2] = GDK_WINDOW_XWINDOW (window);
xev.data.l[3] = 0; /* manager specific data */
xev.data.l[4] = 0; /* manager specific data */
manager);
#endif
/* This is for SYSTEM_TRAY_REQUEST_DOCK and SelectionClear */
- gdk_window_add_filter (invisible->window,
+ gdk_window_add_filter (window,
na_tray_manager_window_filter, manager);
/* This is for SYSTEM_TRAY_BEGIN_MESSAGE and SYSTEM_TRAY_CANCEL_MESSAGE */
gdk_display_add_client_message_filter (display, opcode_atom,